package com.hzj.springcloud.service;

import com.hzj.springcloud.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public List<Dept> show() {
                Dept dept = new Dept("进入降级服务");
                List<Dept> list = new ArrayList<>();
                list.add(dept);
                return list;
            }
        };
    }
}
